// // ******************************************************************
// //       /\ /|       @file       GuidExtensions.cs
// //       \ V/        @brief      await29
// //       | "")       @author     Await, 285283010@qq.com
// //       /  |
// //      /  \\        @Modified   2024-12-08 10:12
// //    *(__\_\        @Copyright  Copyright (c) , 2024-12-08 10:12 Await
// // ******************************************************************

using System.Diagnostics.CodeAnalysis;

namespace AutomaticSubtitles.Service.Infrastructure.Extensions;

/// <summary>
/// Guid specific extensions.
/// </summary>
public static class GuidExtensions
{
    /// <summary>
    /// Determine whether the guid is default.
    /// </summary>
    /// <param name="guid">The guid.</param>
    /// <returns>Whether the guid is the default value.</returns>
    public static bool IsEmpty(this Guid guid)
    {
        return guid.Equals(default);
    }

    /// <summary>
    /// Determine whether the guid is null or default.
    /// </summary>
    /// <param name="guid">The guid.</param>
    /// <returns>Whether the guid is null or the default valueF.</returns>
    public static bool IsNullOrEmpty([NotNullWhen(false)] this Guid? guid)
    {
        return guid is null || guid.Value.IsEmpty();
    }
}